php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33892 serialize contains invalid chars
Submitted: 2005-07-27 22:42 UTC Modified: 2005-07-27 23:06 UTC
From: marcos dot neves at gmail dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.1.0b3 OS: any
Private report: No CVE-ID: None
 [2005-07-27 22:42 UTC] marcos dot neves at gmail dot com
Description:
------------
serialized string returned by serialize, contains invalid chars only when serializing an object with protected or private properties.

Reproduce code:
---------------
<?

class Foo {
	protected $bar = 123;
	//public $bar = 123;
}

$f = new Foo();

echo serialize($f);

?>

Expected result:
----------------
comment protected and uncomment public and the right result is given:

[[O:3:"Foo":1:{s:3:"bar";i:123;}]]

Actual result:
--------------
[[O:3:"Foo":1:{s:6:"
wich means:
[[O:3:"Foo":1:{s:6:"NULL*NULLbar";i:123;}]]
where NULL is the char \0

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-27 23:06 UTC] tony2001@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

See bug #29865.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 02 15:01:33 2024 UTC